package com.hfzy.ihk.facade.linkcall.entity.flow.config;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hfzy.ihk.common.facade.BaseEntity;
import com.hfzy.ihk.facade.linkcall.entity.knowledge.type.IndustryType;
import com.hfzy.ihk.facade.linkcall.enums.CheckStatus;
import com.hfzy.ihk.facade.linkcall.enums.SpeakingFlowType;
import com.hfzy.ihk.facade.linkcall.enums.SpeakingPackageType;
import com.hfzy.ihk.facade.linkcall.enums.SpeakingPackageUseage;
import jdk.nashorn.internal.ir.annotations.Ignore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2018/7/19.
 * 话术包
 * @author wws
 */
@Document(indexName = "#{elasticSearchConfig.indexName()}_speaking_package",shards = 24,replicas = 2, type = "data")
public class SpeakingPackage implements BaseEntity {

    @Id
    @Field(type = FieldType.Keyword)
    private String id;

    private long version;

    @Field(type = FieldType.Keyword)
    private String packageName;

    /***/
    @Field(type = FieldType.Keyword)
    private SpeakingPackageType packageType;

    private long createUserId;

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss" )
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    	/*fastjson局部更新起作用:* 比如增加一条意向* */
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss" )
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    	/*fastjson局部更新起作用:* 比如增加一条意向* */
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date modTime;

    /**话术包的用途*/
    @Field(type = FieldType.Keyword)
    private SpeakingPackageUseage speakingPackageUseage;

    private CheckStatus checkStatus;

    private List<String> hadIndustryTypeId;//拥有的行业知识库类型s 如：所属知识库类型为 房地产行业-二手-住宅 ，则指当前的知识库 包含了 所属知识库类型的 知识库内容

    @Ignore
    private List<String> allIndustryTypeIds;//所持有的行业知识库类型 ids

    @Ignore
    private List<String> defaultIndustryTypeIds;//默认持有的行业知识库类型

    @Override
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public long getVersion() {
        return version;
    }

    public void setVersion(long version) {
        this.version = version;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public SpeakingPackageType getPackageType() {
        return packageType;
    }

    public void setPackageType(SpeakingPackageType packageType) {
        this.packageType = packageType;
    }

    public long getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(long createUserId) {
        this.createUserId = createUserId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModTime() {
        return modTime;
    }

    public void setModTime(Date modTime) {
        this.modTime = modTime;
    }

    public SpeakingPackageUseage getSpeakingPackageUseage() {
        return speakingPackageUseage;
    }

    public void setSpeakingPackageUseage(SpeakingPackageUseage speakingPackageUseage) {
        this.speakingPackageUseage = speakingPackageUseage;
    }

    public CheckStatus getCheckStatus() {
        return checkStatus;
    }

    public void setCheckStatus(CheckStatus checkStatus) {
        this.checkStatus = checkStatus;
    }

    public List<String> getHadIndustryTypeId() {
        return hadIndustryTypeId;
    }

    public void setHadIndustryTypeId(List<String> hadIndustryTypeId) {
        this.hadIndustryTypeId = hadIndustryTypeId;
    }

    public List<String> getAllIndustryTypeIds() {
        List<String> ids = new ArrayList<>();
        if(hadIndustryTypeId!=null && !hadIndustryTypeId.isEmpty()){
            ids.addAll(hadIndustryTypeId);
        }
        if(defaultIndustryTypeIds!=null && !defaultIndustryTypeIds.isEmpty()){
            ids.addAll(defaultIndustryTypeIds);
        }
        return ids;
    }

    public List<String> getDefaultIndustryTypeIds() {
        return defaultIndustryTypeIds;
    }

    public void setDefaultIndustryTypeIds(List<String> defaultIndustryTypeIds) {
        this.defaultIndustryTypeIds = defaultIndustryTypeIds;
    }
}
